/**
 * 文件：WaitDialog.java
 * 包名：com.ronri.common;
 * 说明：进度对话框
 * 作者：MS During
 * 日期：2017/5/19
 * 历史：
 */
package com.ronri.common;

import android.app.ProgressDialog;
import android.content.Context;

public class WaitDialog {

    // 进度对话框
    private static ProgressDialog mWaitDialog = null;

    private static boolean mbShowing = false;

    /****
     * 显示对话框
     * @param szTtitle
     */
    public static void ShowDialog(Context context, String szTtitle)
    {
        try {
            if (mbShowing)
                return;

            if (mWaitDialog == null) {
                mWaitDialog = new ProgressDialog(context);
            }

            mWaitDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            mWaitDialog.setMessage(szTtitle);
            mWaitDialog.setIndeterminate(false);
//            mWaitDialog.setCancelable(false);
            mWaitDialog.setCanceledOnTouchOutside(false);
            mWaitDialog.show();

            mbShowing = true;
        }catch (Exception ex){

        }
    }

    /****
     * 隐藏对话框
     */
    public static void HideDialog()
    {
        try {
            if (mWaitDialog != null) {
                mWaitDialog.dismiss();
                mWaitDialog = null;
                mbShowing = false;
            }
        }catch (Exception ex){

        }
    }
}
